package com.wunu.zn.api.lock.model;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import common.plugin.mybatis.Db;
import common.plugin.mybatis.Model;
import common.plugin.mybatis.Table;
@Table("t_wunu_lock_smartgateway")
public class GatewayEntity extends Model<GatewayEntity> {
	
	/** 查找当前房东下面的所有网关
	 * @return
	 */
	public static List<Map<String, Object>> findGatewayList(String operator,Integer nextId, Integer pageSize) {
		String sql ="select * from t_wunu_lock_room WHERE operator =#{operator} and id <${nextId}  ORDER BY id DESC LIMIT ${limit} ";
		 List<Map<String, Object>> list = Db.find(sql, "operator,nextId,limit", operator,nextId == 0 ? Long.MAX_VALUE : nextId, pageSize);
		 if(list!=null && list.size()>0){
			return list;
		}
		return new ArrayList<Map<String, Object>>();
	}
}
